﻿using System;

namespace TextEditor
{
   

    public class A_SetMultiSelect : A_Action
    {
        public override string ActionName()
        {
            return "setmultiselect";
        }

        public override int CheckState()
        {
            ZYTextSelect currentElement = base.myOwnerDocument.Content.CurrentElement as ZYTextSelect;
            if (currentElement == null)
            {
                return -1;
            }
            return (currentElement.Multiple ? 1 : 0);
        }

        public override bool Execute()
        {
            ZYTextSelect currentElement = base.myOwnerDocument.Content.CurrentElement as ZYTextSelect;
            if (currentElement != null)
            {
                currentElement.Multiple = !currentElement.Multiple;
            }
            return true;
        }

        public override bool isEnable()
        {
            return ((base.myOwnerDocument.CanModify() && (base.myOwnerDocument.Content.CurrentElement is ZYTextSelect)) && base.isEnable());
        }
    }
}

